action nop() {}

/*---------- forward_t ----------*/
action set_egr(egress_spec) {
  modify_field(ig_intr_md_for_tm.ucast_egress_port, egress_spec);
}

@pragma stage 0
table forward_t {
  reads {
  ig_intr_md.ingress_port: exact;
  }
  actions {
    set_egr; nop;
  }
}

/*---------- update_M1_srcip_t ----------*/
blackbox stateful_alu update_M1_srcip_bb
{
 reg: M1_srcip;
 condition_lo: register_lo == 0;
 condition_hi: register_lo == ipv4.srcip;

 update_lo_1_predicate: condition_lo or condition_hi;
 update_lo_1_value: ipv4.srcip;

 output_value: predicate;
 output_dst: m_meta.srcip_pred;
}

action update_M1_srcip_ac()
{
    update_M1_srcip_bb.execute_stateful_alu_from_hash(hash_1);
}

@pragma stage 0
table update_M1_srcip_t
{
    actions {
        update_M1_srcip_ac;
    }
 default_action: update_M1_srcip_ac;
}

/*---------- rewrite_M1_srcip_t ----------*/
blackbox stateful_alu rewrite_M1_srcip_bb
{
 reg: M1_srcip;
 update_lo_1_value: ipv4.srcip;
}

action rewrite_M1_srcip_ac()
{
    rewrite_M1_srcip_bb.execute_stateful_alu_from_hash(hash_1);
}

@pragma stage 0
table rewrite_M1_srcip_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    nop;
    rewrite_M1_srcip_ac;
  }
 default_action: nop;
}

/*---------- update_M1_dstip_t ----------*/
blackbox stateful_alu update_M1_dstip_bb
{
 reg: M1_dstip;
 condition_lo: register_lo == 0;
 condition_hi: register_lo == ipv4.dstip;

 update_lo_1_predicate: condition_lo or condition_hi;
 update_lo_1_value: ipv4.dstip;

 output_value: predicate;
 output_dst: m_meta.dstip_pred;
}

action update_M1_dstip_ac()
{
    update_M1_dstip_bb.execute_stateful_alu_from_hash(hash_1);
}

@pragma stage 0
table update_M1_dstip_t
{
    actions {
        update_M1_dstip_ac;
    }
 default_action: update_M1_dstip_ac;
}

/*---------- rewrite_M1_dstip_t ----------*/
blackbox stateful_alu rewrite_M1_dstip_bb
{
 reg: M1_dstip;
 update_lo_1_value: ipv4.dstip;
}

action rewrite_M1_dstip_ac()
{
    rewrite_M1_dstip_bb.execute_stateful_alu_from_hash(hash_1);
}

@pragma stage 0
table rewrite_M1_dstip_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    rewrite_M1_dstip_ac;
    nop;
  }
 default_action: nop;
}

/*---------- update_M1_proto_t ----------*/
blackbox stateful_alu update_M1_proto_bb
{
 reg: M1_proto;
 condition_lo: register_lo == 0;
 condition_hi: register_lo == ipv4.proto;

 update_lo_1_predicate: condition_lo or condition_hi;
 update_lo_1_value: ipv4.proto;

 output_value: predicate;
 output_dst: m_meta.proto_pred;
}

action update_M1_proto_ac()
{
    update_M1_proto_bb.execute_stateful_alu_from_hash(hash_1);
}

@pragma stage 0
table update_M1_proto_t
{
  actions {
    update_M1_proto_ac;
  }
 default_action: update_M1_proto_ac;
}

/*---------- rewrite_M1_proto_t ----------*/
blackbox stateful_alu rewrite_M1_proto_bb
{
 reg: M1_proto;
 update_lo_1_value: ipv4.proto;
}

action rewrite_M1_proto_ac()
{
    rewrite_M1_proto_bb.execute_stateful_alu_from_hash(hash_1);
}

@pragma stage 0
table rewrite_M1_proto_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    rewrite_M1_proto_ac;
    nop;
  }
 default_action: nop;
}

/*---------- update_M1_cnt_t ----------*/
blackbox stateful_alu increase_M1_cnt_bb
{
 reg: M1_cnt;
 update_lo_1_value: register_lo + 1;
}

action increase_M1_cnt_ac()
{
    increase_M1_cnt_bb.execute_stateful_alu_from_hash(hash_1);
    modify_field(m_meta.M1_collision, 0);
}

blackbox stateful_alu read_M1_cnt_bb
{
 reg: M1_cnt;
 output_value: register_lo;
 output_dst: m_meta.M1_cnt;
}

action read_M1_cnt_ac()
{
    read_M1_cnt_bb.execute_stateful_alu_from_hash(hash_1);
    modify_field(m_meta.M1_collision, 1);
}

@pragma stage 1
table update_M1_cnt_t
{
    reads {
    m_meta.srcip_pred: exact;
    m_meta.dstip_pred: exact;
    m_meta.proto_pred: exact;
    }
    actions {
      increase_M1_cnt_ac;
      read_M1_cnt_ac;
    }
}

/*---------- rewrite_M1_cnt_t ----------*/
blackbox stateful_alu rewrite_M1_cnt_bb
{
 reg: M1_cnt;
 update_lo_1_value: m_meta.prom_num;
}

action rewrite_M1_cnt_ac()
{
  rewrite_M1_cnt_bb.execute_stateful_alu_from_hash(hash_1);
}

@pragma stage 1
table rewrite_M1_cnt_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    rewrite_M1_cnt_ac;
    nop;
  }
 default_action: nop;
}

/*---------- update_M2_srcip_t ----------*/
blackbox stateful_alu update_M2_srcip_bb
{
 reg: M2_srcip;
 condition_lo: register_lo == 0;
 condition_hi: register_lo == ipv4.srcip;

 update_lo_1_predicate: condition_lo or condition_hi;
 update_lo_1_value: ipv4.srcip;

 output_value: predicate;
 output_dst: m_meta.srcip_pred;
}

action update_M2_srcip_ac()
{
    update_M2_srcip_bb.execute_stateful_alu_from_hash(hash_2);
}

@pragma stage 2
table update_M2_srcip_t
{
    actions {
        update_M2_srcip_ac;
    }
 default_action: update_M2_srcip_ac;
}

/*---------- rewrite_M2_srcip_t ----------*/
blackbox stateful_alu rewrite_M2_srcip_bb
{
 reg: M2_srcip;
 update_lo_1_value: ipv4.srcip;
}

action rewrite_M2_srcip_ac()
{
    rewrite_M2_srcip_bb.execute_stateful_alu_from_hash(hash_2);
}

@pragma stage 2
table rewrite_M2_srcip_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    rewrite_M2_srcip_ac;
    nop;
  }
 default_action: nop;
}

/*---------- update_M2_dstip_t ----------*/
blackbox stateful_alu update_M2_dstip_bb
{
 reg: M2_dstip;
 condition_lo: register_lo == 0;
 condition_hi: register_lo == ipv4.dstip;

 update_lo_1_predicate: condition_lo or condition_hi;
 update_lo_1_value: ipv4.dstip;

 output_value: predicate;
 output_dst: m_meta.dstip_pred;
}

action update_M2_dstip_ac()
{
    update_M2_dstip_bb.execute_stateful_alu_from_hash(hash_2);
}

@pragma stage 2
table update_M2_dstip_t
{
    actions {
        update_M2_dstip_ac;
    }
 default_action: update_M2_dstip_ac;
}

/*---------- rewrite_M2_dstip_t ----------*/
blackbox stateful_alu rewrite_M2_dstip_bb
{
 reg: M2_dstip;
 update_lo_1_value: ipv4.dstip;
}

action rewrite_M2_dstip_ac()
{
    rewrite_M2_dstip_bb.execute_stateful_alu_from_hash(hash_2);
}

@pragma stage 2
table rewrite_M2_dstip_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    nop;
    rewrite_M2_dstip_ac;
  }
 default_action: nop;
}

/*---------- update_M2_proto_t ----------*/
blackbox stateful_alu update_M2_proto_bb
{
 reg: M2_proto;
 condition_lo: register_lo == 0;
 condition_hi: register_lo == ipv4.proto;

 update_lo_1_predicate: condition_lo or condition_hi;
 update_lo_1_value: ipv4.proto;

 output_value: predicate;
 output_dst: m_meta.proto_pred;
}

action update_M2_proto_ac()
{
    update_M2_proto_bb.execute_stateful_alu_from_hash(hash_2);
}

@pragma stage 2
table update_M2_proto_t
{
    actions {
        update_M2_proto_ac;
    }
    default_action: update_M2_proto_ac;
}

/*---------- rewrite_M2_proto_t ----------*/
blackbox stateful_alu rewrite_M2_proto_bb
{
 reg: M2_proto;
 update_lo_1_value: ipv4.proto;
}

action rewrite_M2_proto_ac()
{
    rewrite_M2_proto_bb.execute_stateful_alu_from_hash(hash_2);
}

@pragma stage 2
table rewrite_M2_proto_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    nop;
    rewrite_M2_proto_ac;
  }
 default_action: nop;
}

/*---------- update_M2_cnt_t ----------*/
blackbox stateful_alu increase_M2_cnt_bb
{
 reg: M2_cnt;
 update_lo_1_value: register_lo + 1;
}

action increase_M2_cnt_ac()
{
    increase_M2_cnt_bb.execute_stateful_alu_from_hash(hash_2);
    modify_field(m_meta.M2_collision, 0);
}

blackbox stateful_alu read_M2_cnt_bb
{
 reg: M2_cnt;

 output_value: register_lo;
 output_dst: m_meta.M2_cnt;
}

action read_M2_cnt_ac()
{
  read_M2_cnt_bb.execute_stateful_alu_from_hash(hash_2);
  modify_field(m_meta.M2_collision, 1);
}

@pragma stage 3
table update_M2_cnt_t
{
    reads {
    m_meta.srcip_pred: exact;
    m_meta.dstip_pred: exact;
    m_meta.proto_pred: exact;
    }
    actions {
      read_M2_cnt_ac;
      increase_M2_cnt_ac;
    }
}

/*---------- rewrite_M2_cnt_t ----------*/
blackbox stateful_alu rewrite_M2_cnt_bb
{
 reg: M2_cnt;
 update_lo_1_value: m_meta.prom_num;
}

action rewrite_M2_cnt_ac()
{
    rewrite_M2_cnt_bb.execute_stateful_alu_from_hash(hash_2);
}

@pragma stage 3
table rewrite_M2_cnt_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    nop;
    rewrite_M2_cnt_ac;
  }
 default_action: nop;
}

/*---------- update_M3_srcip_t ----------*/
blackbox stateful_alu update_M3_srcip_bb
{
 reg: M3_srcip;
 condition_lo: register_lo == 0;
 condition_hi: register_lo == ipv4.srcip;

 update_lo_1_predicate: condition_lo or condition_hi;
 update_lo_1_value: ipv4.srcip;

 output_value: predicate;
 output_dst: m_meta.srcip_pred;
}

action update_M3_srcip_ac()
{
    update_M3_srcip_bb.execute_stateful_alu_from_hash(hash_3);
}

@pragma stage 4
table update_M3_srcip_t
{
    actions {
        update_M3_srcip_ac;
    }
    default_action: update_M3_srcip_ac;
}

/*---------- rewrite_M3_srcip_t ----------*/
blackbox stateful_alu rewrite_M3_srcip_bb
{
 reg: M3_srcip;
 update_lo_1_value: ipv4.srcip;
}

action rewrite_M3_srcip_ac()
{
    rewrite_M3_srcip_bb.execute_stateful_alu_from_hash(hash_3);
}

@pragma stage 4
table rewrite_M3_srcip_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    nop;
    rewrite_M3_srcip_ac;
  }
 default_action: nop;
}

/*---------- update_M3_dstip_t ----------*/
blackbox stateful_alu update_M3_dstip_bb
{
 reg: M3_dstip;
 condition_lo: register_lo == 0;
 condition_hi: register_lo == ipv4.dstip;

 update_lo_1_predicate: condition_lo or condition_hi;
 update_lo_1_value: ipv4.dstip;

 output_value: predicate;
 output_dst: m_meta.dstip_pred;
}

action update_M3_dstip_ac()
{
    update_M3_dstip_bb.execute_stateful_alu_from_hash(hash_3);
}

@pragma stage 4
table update_M3_dstip_t
{
    actions {
      update_M3_dstip_ac;
    }
    default_action: update_M3_dstip_ac;
}

/*---------- rewrite_M3_dstip_t ----------*/
blackbox stateful_alu rewrite_M3_dstip_bb
{
 reg: M3_dstip;
 update_lo_1_value: ipv4.dstip;
}

action rewrite_M3_dstip_ac()
{
    rewrite_M3_dstip_bb.execute_stateful_alu_from_hash(hash_3);
}

@pragma stage 4
table rewrite_M3_dstip_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    nop;
    rewrite_M3_dstip_ac;
  }
 default_action: nop;
}

/*---------- update_M3_proto_t ----------*/
blackbox stateful_alu update_M3_proto_bb
{
 reg: M3_proto;
 condition_lo: register_lo == 0;
 condition_hi: register_lo == ipv4.proto;

 update_lo_1_predicate: condition_lo or condition_hi;
 update_lo_1_value: ipv4.proto;

 output_value: predicate;
 output_dst: m_meta.proto_pred;
}

action update_M3_proto_ac()
{
    update_M3_proto_bb.execute_stateful_alu_from_hash(hash_3);
}

@pragma stage 4
table update_M3_proto_t
{
    actions {
        update_M3_proto_ac;
    }
    default_action: update_M3_proto_ac;
}

/*---------- rewrite_M3_proto_t ----------*/
blackbox stateful_alu rewrite_M3_proto_bb
{
 reg: M3_proto;
 update_lo_1_value: ipv4.proto;
}

action rewrite_M3_proto_ac()
{
    rewrite_M3_proto_bb.execute_stateful_alu_from_hash(hash_3);
}

@pragma stage 4
table rewrite_M3_proto_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    nop;
    rewrite_M3_proto_ac;
  }
 default_action: nop;
}

/*---------- update_M3_cnt_t ----------*/
blackbox stateful_alu increase_M3_cnt_bb
{
 reg: M3_cnt;
 update_lo_1_value: register_lo + 1;
}

action increase_M3_cnt_ac()
{
    increase_M3_cnt_bb.execute_stateful_alu_from_hash(hash_3);
    modify_field(m_meta.M3_collision, 0);
}

blackbox stateful_alu read_M3_cnt_bb
{
 reg: M3_cnt;

 output_value: register_lo;
 output_dst: m_meta.M3_cnt;
}

action read_M3_cnt_ac()
{
    read_M3_cnt_bb.execute_stateful_alu_from_hash(hash_3);
    modify_field(m_meta.M3_collision, 1);
}

@pragma stage 5
table update_M3_cnt_t
{
    reads {
    m_meta.srcip_pred: exact;
    m_meta.dstip_pred: exact;
    m_meta.proto_pred: exact;
    }
    actions {
      increase_M3_cnt_ac;
      read_M3_cnt_ac;
    }
}

/*---------- rewrite_M3_cnt_t ----------*/
blackbox stateful_alu rewrite_M3_cnt_bb
{
 reg: M3_cnt;
 update_lo_1_value: m_meta.prom_num;
}

action rewrite_M3_cnt_ac()
{
    rewrite_M3_cnt_bb.execute_stateful_alu_from_hash(hash_3);
}

@pragma stage 5
table rewrite_M3_cnt_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    nop;
    rewrite_M3_cnt_ac;
  }
 default_action: nop;
}

/*---------- update_M4_srcip_t ----------*/
blackbox stateful_alu update_M4_srcip_bb
{
 reg: M4_srcip;
 condition_lo: register_lo == 0;
 condition_hi: register_lo == ipv4.srcip;

 update_lo_1_predicate: condition_lo or condition_hi;
 update_lo_1_value: ipv4.srcip;

 output_value: predicate;
 output_dst: m_meta.srcip_pred;
}

action update_M4_srcip_ac()
{
  update_M4_srcip_bb.execute_stateful_alu_from_hash(hash_4);
}

@pragma stage 6
table update_M4_srcip_t
{
  actions {
    update_M4_srcip_ac;
  }
 default_action: update_M4_srcip_ac;
}

/*---------- rewrite_M4_srcip_t ----------*/
blackbox stateful_alu rewrite_M4_srcip_bb
{
 reg: M4_srcip;
 update_lo_1_value: ipv4.srcip;
}

action rewrite_M4_srcip_ac()
{
  rewrite_M4_srcip_bb.execute_stateful_alu_from_hash(hash_4);
}

@pragma stage 6
table rewrite_M4_srcip_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    nop;
    rewrite_M4_srcip_ac;
  }
 default_action: nop;
}

/*---------- update_M4_dstip_t ----------*/
blackbox stateful_alu update_M4_dstip_bb
{
 reg: M4_dstip;
 condition_lo: register_lo == 0;
 condition_hi: register_lo == ipv4.dstip;

 update_lo_1_predicate: condition_lo or condition_hi;
 update_lo_1_value: ipv4.dstip;

 output_value: predicate;
 output_dst: m_meta.dstip_pred;
}

action update_M4_dstip_ac()
{
    update_M4_dstip_bb.execute_stateful_alu_from_hash(hash_4);
}

@pragma stage 6
table update_M4_dstip_t
{
    actions {
      update_M4_dstip_ac;
    }
    default_action: update_M4_dstip_ac;
}

/*---------- rewrite_M4_dstip_t ----------*/
blackbox stateful_alu rewrite_M4_dstip_bb
{
 reg: M4_dstip;
 update_lo_1_value: ipv4.dstip;
}

action rewrite_M4_dstip_ac()
{
    rewrite_M4_dstip_bb.execute_stateful_alu_from_hash(hash_4);
}

@pragma stage 6
table rewrite_M4_dstip_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    nop;
    rewrite_M4_dstip_ac;
  }
 default_action: nop;
}

/*---------- update_M4_proto_t ----------*/
blackbox stateful_alu update_M4_proto_bb
{
 reg: M4_proto;
 condition_lo: register_lo == 0;
 condition_hi: register_lo == ipv4.proto;

 update_lo_1_predicate: condition_lo or condition_hi;
 update_lo_1_value: ipv4.proto;

 output_value: predicate;
 output_dst: m_meta.proto_pred;
}

action update_M4_proto_ac()
{
    update_M4_proto_bb.execute_stateful_alu_from_hash(hash_4);
}

@pragma stage 6
table update_M4_proto_t
{
    actions {
        update_M4_proto_ac;
    }
    default_action: update_M4_proto_ac;
}

/*---------- rewrite_M4_proto_t ----------*/
blackbox stateful_alu rewrite_M4_proto_bb
{
 reg: M4_proto;
 update_lo_1_value: ipv4.proto;
}

action rewrite_M4_proto_ac()
{
    rewrite_M4_proto_bb.execute_stateful_alu_from_hash(hash_4);
}

@pragma stage 6
table rewrite_M4_proto_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    nop;
    rewrite_M4_proto_ac;
  }
 default_action: nop;
}

/*---------- update_M4_cnt_t ----------*/
blackbox stateful_alu increase_M4_cnt_bb
{
 reg: M4_cnt;
 update_lo_1_value: register_lo + 1;
}

action increase_M4_cnt_ac()
{
    increase_M4_cnt_bb.execute_stateful_alu_from_hash(hash_4);
    modify_field(m_meta.M4_collision, 0);
}

blackbox stateful_alu read_M4_cnt_bb
{
 reg: M4_cnt;

 output_value: register_lo;
 output_dst: m_meta.M4_cnt;
}

action read_M4_cnt_ac()
{
    read_M4_cnt_bb.execute_stateful_alu_from_hash(hash_4);
    modify_field(m_meta.M4_collision, 1);
}

@pragma stage 7
table update_M4_cnt_t
{
    reads {
    m_meta.srcip_pred: exact;
    m_meta.dstip_pred: exact;
    m_meta.proto_pred: exact;
    }
    actions {
      increase_M4_cnt_ac;
      read_M4_cnt_ac;
    }
}

/*---------- rewrite_M4_cnt_t ----------*/
blackbox stateful_alu rewrite_M4_cnt_bb
{
 reg: M4_cnt;
 update_lo_1_value: m_meta.prom_num;
}

action rewrite_M4_cnt_ac()
{
    rewrite_M4_cnt_bb.execute_stateful_alu_from_hash(hash_4);
}

@pragma stage 7
table rewrite_M4_cnt_t {
  reads {
  m_meta.stage: exact;
  }
  actions {
    nop;
    rewrite_M4_cnt_ac;
  }
 default_action: nop;
}

/*---------- compare_M_cnts_t ----------*/
action compare_M_cnts_ac() {
  subtract(m_meta.flag1, m_meta.M1_cnt, m_meta.M2_cnt);
  subtract(m_meta.flag2, m_meta.M1_cnt, m_meta.M3_cnt);
  subtract(m_meta.flag3, m_meta.M1_cnt, m_meta.M4_cnt);
  subtract(m_meta.flag4, m_meta.M2_cnt, m_meta.M3_cnt);
  subtract(m_meta.flag5, m_meta.M2_cnt, m_meta.M4_cnt);
  subtract(m_meta.flag6, m_meta.M3_cnt, m_meta.M4_cnt);
}

table compare_M_cnts_t {
  actions {
    compare_M_cnts_ac;
  }
 default_action: compare_M_cnts_ac;
}

/*---------- set_min_t ----------*/
action set_min_M1_cnt_ac() {
  modify_field(m_meta.min, m_meta.M1_cnt);
  modify_field(m_meta.stage, 1);
}

action set_min_M2_cnt_ac() {
  modify_field(m_meta.min, m_meta.M2_cnt);
  modify_field(m_meta.stage, 2);
}

action set_min_M3_cnt_ac() {
  modify_field(m_meta.min, m_meta.M3_cnt);
  modify_field(m_meta.stage, 3);
}

action set_min_M4_cnt_ac() {
  modify_field(m_meta.min, m_meta.M4_cnt);
  modify_field(m_meta.stage, 4);
}

table set_min_t {
  reads {
  m_meta.flag1: ternary;
  m_meta.flag2: ternary;
  m_meta.flag3: ternary;
  m_meta.flag4: ternary;
  m_meta.flag5: ternary;
  m_meta.flag6: ternary;
  }
  actions {
    set_min_M1_cnt_ac;
    set_min_M2_cnt_ac;
    set_min_M3_cnt_ac;
    set_min_M4_cnt_ac;
  }
}

/*---------- gen_rand_num_t ----------*/
action gen_rand_num_ac() {
  modify_field_rng_uniform(m_meta.rand_num, 0, 4294967295);
}

table gen_rand_num_t {
  actions {
    gen_rand_num_ac;
  }
 default_action: gen_rand_num_ac;
}

/*---------- resubmit_t ----------*/
blackbox stateful_alu count_resubmission_bb
{
 reg: resubmission_counter;
 update_lo_1_value: register_lo + 1;
}

field_list resubmit_fields
{
    m_meta.promotion; //1 bits
    m_meta.stage; //4 bits
    m_meta.prom_num; //27 bits
}

action resubmit_ac(prom_num)
{
  modify_field(m_meta.prom_num, prom_num);
  modify_field(m_meta.promotion, 1);
  resubmit(resubmit_fields);
  count_resubmission_bb.execute_stateful_alu(0);
}

table resubmit_t
{
  reads {
  m_meta.min: ternary;
  m_meta.rand_num: ternary;
  }
  actions {
    resubmit_ac; //highest bit is 1
    nop;
  }
 default_action: nop;
}

/*++++++++++ count_packet_t ++++++++++*/
blackbox stateful_alu count_packet_bb
{
 reg: packet_counter;
 update_lo_1_value: register_lo + 1;
 /* update_lo_1_value: m_meta.min; */
}

action count_packet_ac()
{
  count_packet_bb.execute_stateful_alu(0);
}

table count_packet_t {
  /* reads { */
  /* m_meta.min: exact; */
  /* } */
  actions {
    count_packet_ac;
    nop;
  }
 default_action: count_packet_ac;
}
/*----------*/

/*++++++++++ count_ip_packet_t ++++++++++*/
blackbox stateful_alu count_ip_packet_bb
{
 reg: ip_packet_counter;
 update_lo_1_value: register_lo + 1;
}

action count_ip_packet_ac()
{
  count_ip_packet_bb.execute_stateful_alu(0);
}

table count_ip_packet_t {
  /* reads { */
  /* ipv4: valid; */
  /* } */
  actions {
    count_ip_packet_ac;
  }
 default_action: count_ip_packet_ac;
}
/*----------*/

/*++++++++++ take_min_t ++++++++++*/
blackbox stateful_alu take_min_bb
{
 reg: min_reg;
 update_lo_1_value: register_lo + 1;
}

action take_min_ac()
{
  take_min_bb.execute_stateful_alu(0);
}

table take_min_t {
  actions {
    take_min_ac;
  }
 default_action: take_min_ac;
}
/*----------*/

/*++++++++++ take_prom_num_t ++++++++++*/
blackbox stateful_alu take_prom_num_bb
{
 reg: prom_num_reg;
 update_lo_1_value: register_lo + 1;
}

action take_prom_num_ac()
{
  take_prom_num_bb.execute_stateful_alu(0);
}

table take_prom_num_t {
  actions {
    take_prom_num_ac;
  }
 default_action: take_prom_num_ac;
}
/*----------*/

/*++++++++++ take_rand_t ++++++++++*/
blackbox stateful_alu take_rand_bb
{
 reg: rand_reg;
 update_lo_1_value: register_lo + 1;
}

action take_rand_ac()
{
  take_rand_bb.execute_stateful_alu(0);
}

table take_rand_t {
  actions {
    take_rand_ac;
  }
 default_action: take_rand_ac;
}
/*----------*/
